package com.yq.design.flyWeight.simple;

import java.util.HashMap;

/**
 * @ClassName Factory
 * @Description TODO
 * @Author yaoqiang
 * @Date 2021/3/1 15:16
 * @Version 1.0
 */
public class Factory {

    private HashMap<String,Object> pool=new HashMap<>();

    public Web getWeb(String type){
        if (!pool.containsKey(type)){
            pool.put(type,new ConcreteWeb(type));
        }
            System.out.println(pool.size());
        return (Web) pool.get(type);
    }
}
